DIY Exercise 7-1: Track data through a Mule application
Time estimate: 1 hour
Objectives
In this exercise, you track data through an application that has several flows. You will:
· Track data through flows when a Flow Reference is used.
· Replace a Flow Reference with an HTTP Request to provide a connection boundary.
· Track data through flows when a connection boundary is in place.
· Ensure Mule event data is accessible in a flow before and after it crosses a connection boundary.
Scenario
You are tasked with tracking crucial data for a project for logging and auditing purposes. You need to save the Mule event payload, variables, and attributes as data passes between different flows and servers.
Import the starter project
Import /files/module07/structure-mod07-starter.jar (in the MUFundamentals4.x DIY Files zip that you can download from the Course Resources) into Anypoint Studio.
Debug the project
Debug the project and make a GET request to http://localhost:8081/flights?destination=SFO with a header named Requester-ID set to "AJ46".
Answer the following questions
· What is the result of the GET request to /flights?
· Are the payload, variables, and attributes accessible in all of the flows in the Mule application?
Replace the mockData Flow Reference with an HTTP Request
Replace the mockData Flow Reference with an HTTP Request configured to make a GET request to http://mu.learn.mulesoft.com/american/{destination}, where destination is a URI parameter that passes the value from the destination query parameter.
Answer the following questions
· What is the result of a web client request to /flights?
· Are the payload, variables, and attributes accessible in all of the flows in the Mule application?
· What data is accessible after crossing a connection boundary (with the HTTP Request)?
Make the header value accessible in all flows
Modify the Mule application to make the requester-id header accessible in all of the flows.
In the Transform Message component for the processData flow, add a date key that references the date header returned from the HTTP GET request to the mu.learn.mulesoft.com/{destination} endpoint.
Verify your solution
Load the solutions /files/module07/solutions/structure-mod07-solution1.jar (in the MUFundamentals4.x DIY Files zip that you can download from the Course Resources) and compare your solution.